<?php defined('SYSPATH') or die('No direct script access.');

class URL extends Kohana_URL {
	public static function host($uri = '')
	{
		return  Request::current()->protocol() . '://' . $_SERVER['HTTP_HOST'] . $uri;
	}
	public static function home()
	{
		return self::base(TRUE);
	}
	public static function js()
	{
		return self::home() . 'js/';
	}
	public static function css($cssfile = '')
	{
		return self::home() . 'css/'.$cssfile;
	}

	/*ed-api uri*/
	public static function edapi($uri = '')
	{
		$conf = Kohana::config('edapi_config.api');
		$conf['port'] = is_bool($conf['port']) ? '' : ":{$conf['port']}";
		return "{$conf['protocol']}://{$conf['host']}{$conf['port']}{$conf['path']}/{$uri}";
	}
	//controller
	public static function frame()
	{
		return self::home() . 'adminframe/';
	}
}
